<?php
/*
Bitsand - a web-based booking system for LRP events
Copyright (C) 2006 Russell Peter Phillips

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

include ('../inc/inc_head_db.php');
include ('../inc/inc_admin.php');
include ('../inc/inc_head_html.php');

//Get list of players
$db_prefix = DB_PREFIX;
$sql = "SELECT plPlayerID, " .
	"plFirstName, " .
	"plSurname, " .
	"UPPER(plCarRegistration) AS uCarRegistration, " .
	"chName " .
	"FROM {$db_prefix}players, {$db_prefix}characters, {$db_prefix}bookings " .
	"WHERE plPlayerID = chPlayerID AND chPlayerID = bkPlayerID AND bkDatePaymentConfirmed <> '0000-00-00'";
$result = ba_db_query ($link, $sql);
?>
<script src="../inc/sorttable.js" type="text/javascript"></script>

<h1><?php echo TITLE?> - Bookings Status</h1>

<p>
<a href = 'admin.php'>Admin</a>
</p>

<p>
Click on a column header to sort by that column. Click on a player's ID to see that player's details.
</p>

<table border = '1' class="sortable">
<tr>
<th>Player ID</th>
<th>OOC First Name</th>
<th>OOC Surname</th>
<th>IC Name</th>
<th>Car Registration</th>
</tr>

<?php
while ($row = ba_db_fetch_assoc ($result)) {
	echo "<tr class = 'highlight'>\n<td>";
	echo "<a href = 'admin_viewdetails.php?pid=" . $row ['plPlayerID'] . "'>";
	echo PID_PREFIX . sprintf ('%03s', $row ['plPlayerID']) . "</a></td>\n<td>";
	echo htmlentities (stripslashes ($row ['plFirstName']));
	echo "</td>\n<td>";
	echo htmlentities (stripslashes ($row ['plSurname']));
	echo "</td>\n<td>";
	echo htmlentities (stripslashes ($row ['chName']));
	echo "</td>\n<td>";
	echo htmlentities (stripslashes ($row ['uCarRegistration']));
	echo "</td>\n</tr>";
}
?>

</table>

<?php
include ('../inc/inc_foot.php');
?>
